package com.ruoyi.web.controller.counter;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.counter.domain.Opdoor;
import com.ruoyi.counter.domain.RecordsStatistics;
import com.ruoyi.counter.domain.RecordsStatisticsVo;
import com.ruoyi.counter.domain.Signin;
import com.ruoyi.counter.service.IRecordsStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * 工具汇总统计Controller
 *
 * @author xll
 * @date 2021-07-30
 */
@RestController
@RequestMapping("/counter/Statistics")
public class RecordsStatisticsController extends BaseController
{


    @Autowired
    private IRecordsStatisticsService recordsStatisticsService;


    /**
     * 查询登录记录列表
     */
   // @PreAuthorize("@ss.hasPermi('counter:Statistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(RecordsStatistics recordsStatistics)
    {

        startPage();
        List<RecordsStatisticsVo> list = recordsStatisticsService.selectRecordsStatisticsList(recordsStatistics);
        return getDataTable(list);
    }


    /**
     * 导出列表数据
     */

   // @PreAuthorize("@ss.hasPermi('counter:Statistics:export')")
    @Log(title = "工具汇总统计记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(RecordsStatistics recordsStatistics)
    {
        List<RecordsStatisticsVo> list = recordsStatisticsService.selectRecordsStatisticsList(recordsStatistics);
        ExcelUtil<RecordsStatisticsVo> util = new ExcelUtil<RecordsStatisticsVo>(RecordsStatisticsVo.class);
        return util.exportExcel(list, "柜门记录数据");
    }

}
